Skip to content

Conversation

@samueleresca
Copy link
Member

@samueleresca samueleresca commented Oct 12, 2025

Which issue does this PR close?

Rationale for this change

These changes add a safer version of append_value in ByteViewBuilder that handles panics called try_append_value. Datafusions will consume the API and handle the Result coming back from the function.

What changes are included in this PR?

Are these changes tested?

The method is already covered by existing tests.

Are there any user-facing changes?

No breaking changes, as the original append_value method hasn't changed.

@github-actions github-actions bot added the arrow Changes to the arrow crate label Oct 12, 2025
@samueleresca samueleresca force-pushed the safer-appendvalue-bytes-view branch from 73faf99 to 8859ff7 Compare October 12, 2025 19:45
@samueleresca samueleresca marked this pull request as ready for review October 13, 2025 21:03
.map(u32::from_le_bytes)
.ok_or_else(|| {
ArrowError::InvalidArgumentError(
"String must be at least 4 bytes for non-inline view".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This error is unreachable as we checked that the value is longer than MAX_INLINE_VIEW_LEN (12 bytes) above.

let offset = self.in_progress.len() as u32;
let offset: u32 = self.in_progress.len().try_into().map_err(|_| {
ArrowError::InvalidArgumentError(format!(
"In-progress buffer length {} exceeds u32::MAX",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think the method can recover by starting a new in-progress buffer instead of returning an error here.

  2. I am unsure if this error is even reachable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a new buffer would be allocated in the line immediately above this. Maybe we should do a checked add in let required_cap = self.in_progress.len() + v.len(); 🤔

To error here, we would need a usize that doesn't fit into a u32.. I think all platforms we care about have usize that is at least u32 (aka 32-bit architectures)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To error here, we would need a usize that doesn't fit into a u32.. I think all platforms we care about have usize that is at least u32 (aka 32-bit architectures)

I think that would be the opposite, a usize in a 64-bit arch wouldn't fit a u32? Anyway, I will review and update these changes over the weekend

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right -- thank you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure if this error is even reachable.

I think this is right. I wasn't able to trigger this. For the panic to verify, it would need to skip the flush_in_progress() operation that happens when the buffer reaches the required capacity.

On top of that, the push_completed used by the flush_in_progress asserts on the block.len() (see below). Therefore, let offset: u32 = self.in_progress.len() wouldn't be reached:

fn push_completed(&mut self, block: Buffer) {
assert!(block.len() < u32::MAX as usize, "Block too large");
assert!(self.completed.len() < u32::MAX as usize, "Too many blocks");
self.completed.push(block);

I'm proceeding by reverting this the map_err in the offset initialization.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @samueleresca

let offset = self.in_progress.len() as u32;
let offset: u32 = self.in_progress.len().try_into().map_err(|_| {
ArrowError::InvalidArgumentError(format!(
"In-progress buffer length {} exceeds u32::MAX",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a new buffer would be allocated in the line immediately above this. Maybe we should do a checked add in let required_cap = self.in_progress.len() + v.len(); 🤔

To error here, we would need a usize that doesn't fit into a u32.. I think all platforms we care about have usize that is at least u32 (aka 32-bit architectures)

@alamb
Copy link
Contributor

alamb commented Oct 16, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1016-gcp #17~24.04.1-Ubuntu SMP Wed Sep 3 01:55:36 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (bfe53a8) to 5a384f4 diff
BENCH_NAME=view_types
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench view_types
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @samueleresca and @ctsk -- this change makes sense to me.

I have kicked off some benchmark runs just to make sure this doesn't affect performance somehow. Assuming they look good I think we can merge this one in

@alamb
Copy link
Contributor

alamb commented Oct 16, 2025

🤖: Benchmark completed

Details

group                                             main                                   safer-appendvalue-bytes-view
-----                                             ----                                   ----------------------------
gc view types all without nulls[100000]           1.02      2.5±0.07ms        ? ?/sec    1.00      2.5±0.08ms        ? ?/sec
gc view types all without nulls[8000]             1.01     92.9±2.25µs        ? ?/sec    1.00     92.1±3.18µs        ? ?/sec
gc view types all[100000]                         1.11   458.7±27.66µs        ? ?/sec    1.00   415.1±28.14µs        ? ?/sec
gc view types all[8000]                           1.31     32.7±5.98µs        ? ?/sec    1.00     24.9±6.02µs        ? ?/sec
gc view types slice half without nulls[100000]    1.02   783.5±26.10µs        ? ?/sec    1.00   771.4±38.10µs        ? ?/sec
gc view types slice half without nulls[8000]      1.00     40.6±2.12µs        ? ?/sec    1.01     41.0±1.36µs        ? ?/sec
gc view types slice half[100000]                  1.39    217.9±8.67µs        ? ?/sec    1.00   156.8±34.25µs        ? ?/sec
gc view types slice half[8000]                    1.00     15.7±3.11µs        ? ?/sec    1.02     16.0±1.30µs        ? ?/sec
view types slice                                  1.04  1093.2±43.30ns        ? ?/sec    1.00  1047.9±40.54ns        ? ?/sec

@alamb
Copy link
Contributor

alamb commented Oct 16, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1016-gcp #17~24.04.1-Ubuntu SMP Wed Sep 3 01:55:36 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (bfe53a8) to 5a384f4 diff
BENCH_NAME=filter_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench filter_kernels
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (df730fd) to d49f017 diff
BENCH_NAME=view_types
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench view_types
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

group                                             main                                   safer-appendvalue-bytes-view
-----                                             ----                                   ----------------------------
gc view types all without nulls[100000]           1.00  1433.3±46.24µs        ? ?/sec    1.02  1464.0±35.54µs        ? ?/sec
gc view types all without nulls[8000]             1.03     66.2±3.95µs        ? ?/sec    1.00     64.3±2.57µs        ? ?/sec
gc view types all[100000]                         1.00    281.2±4.28µs        ? ?/sec    1.01    284.1±6.83µs        ? ?/sec
gc view types all[8000]                           1.01     21.5±0.03µs        ? ?/sec    1.00     21.3±0.04µs        ? ?/sec
gc view types slice half without nulls[100000]    1.00    516.9±6.07µs        ? ?/sec    1.02    527.8±6.12µs        ? ?/sec
gc view types slice half without nulls[8000]      1.00     27.3±0.19µs        ? ?/sec    1.01     27.5±0.30µs        ? ?/sec
gc view types slice half[100000]                  1.01    139.5±2.59µs        ? ?/sec    1.00    138.6±2.59µs        ? ?/sec
gc view types slice half[8000]                    1.01     10.9±0.08µs        ? ?/sec    1.00     10.8±0.01µs        ? ?/sec
view types slice                                  1.00    703.7±2.05ns        ? ?/sec    1.00    706.5±3.89ns        ? ?/sec

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (df730fd) to d49f017 diff
BENCH_NAME=builder
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench builder
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

group                                          main                                   safer-appendvalue-bytes-view
-----                                          ----                                   ----------------------------
bench_bool/bench_bool                          1.00   1087.6±5.50µs   459.7 MB/sec    1.00  1089.7±10.29µs   458.9 MB/sec
bench_decimal128_builder                       1.03    104.3±0.19µs        ? ?/sec    1.00    101.2±0.12µs        ? ?/sec
bench_decimal256_builder                       1.03    108.9±0.15µs        ? ?/sec    1.00    105.7±0.21µs        ? ?/sec
bench_decimal32_builder                        1.00     47.3±0.11µs        ? ?/sec    1.00     47.4±0.12µs        ? ?/sec
bench_decimal64_builder                        1.00     51.0±0.14µs        ? ?/sec    1.00     51.1±0.09µs        ? ?/sec
bench_primitive/bench_primitive                1.00    166.2±6.06µs    23.5 GB/sec    1.04    172.6±6.56µs    22.6 GB/sec
bench_primitive/bench_string                   1.00      7.3±0.16ms   893.5 MB/sec    1.01      7.3±0.21ms   886.8 MB/sec
bench_primitive_nulls/bench_primitive_nulls    1.00   1551.1±3.56µs        ? ?/sec    1.00   1552.6±3.29µs        ? ?/sec

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (df730fd) to d49f017 diff
BENCH_NAME=concatenate_kernel
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench concatenate_kernel
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

group                                                          main                                   safer-appendvalue-bytes-view
-----                                                          ----                                   ----------------------------
concat 1024 arrays boolean 4                                   1.00     28.4±0.06µs        ? ?/sec    1.01     28.7±0.04µs        ? ?/sec
concat 1024 arrays i32 4                                       1.03     14.2±0.02µs        ? ?/sec    1.00     13.8±0.03µs        ? ?/sec
concat 1024 arrays str 4                                       1.00     35.7±0.26µs        ? ?/sec    1.03     36.9±0.31µs        ? ?/sec
concat boolean 1024                                            1.06    427.9±0.78ns        ? ?/sec    1.00    403.3±0.52ns        ? ?/sec
concat boolean 8192 over 100 arrays                            1.00     50.9±0.09µs        ? ?/sec    1.00     51.1±0.06µs        ? ?/sec
concat boolean nulls 1024                                      1.00    758.4±1.18ns        ? ?/sec    1.00    758.0±0.98ns        ? ?/sec
concat boolean nulls 8192 over 100 arrays                      1.00    109.5±0.14µs        ? ?/sec    1.00    109.8±0.17µs        ? ?/sec
concat fixed size lists                                        1.00   704.3±20.28µs        ? ?/sec    1.08   763.6±22.48µs        ? ?/sec
concat i32 1024                                                1.00    386.9±1.07ns        ? ?/sec    1.01    390.0±0.67ns        ? ?/sec
concat i32 8192 over 100 arrays                                1.00    226.3±8.11µs        ? ?/sec    1.03    233.2±8.79µs        ? ?/sec
concat i32 nulls 1024                                          1.01    713.8±1.68ns        ? ?/sec    1.00    709.7±1.00ns        ? ?/sec
concat i32 nulls 8192 over 100 arrays                          1.00    289.9±6.99µs        ? ?/sec    1.04   302.7±16.00µs        ? ?/sec
concat str 1024                                                1.00     13.2±0.73µs        ? ?/sec    1.05     13.9±1.05µs        ? ?/sec
concat str 8192 over 100 arrays                                1.00    105.4±1.24ms        ? ?/sec    1.02    108.1±0.83ms        ? ?/sec
concat str nulls 1024                                          1.09      6.6±0.85µs        ? ?/sec    1.00      6.1±0.78µs        ? ?/sec
concat str nulls 8192 over 100 arrays                          1.00     52.8±0.58ms        ? ?/sec    1.01     53.4±0.52ms        ? ?/sec
concat str_dict 1024                                           1.00      2.9±0.01µs        ? ?/sec    1.03      3.0±0.01µs        ? ?/sec
concat str_dict_sparse 1024                                    1.00      7.1±0.03µs        ? ?/sec    1.01      7.1±0.03µs        ? ?/sec
concat struct with int32 and dicts size=1024 count=2           1.00      6.8±0.27µs        ? ?/sec    1.01      6.9±0.02µs        ? ?/sec
concat utf8_view  max_str_len=128 null_density=0               1.00     77.4±0.18µs        ? ?/sec    1.00     77.4±0.16µs        ? ?/sec
concat utf8_view  max_str_len=128 null_density=0.2             1.00     83.8±0.21µs        ? ?/sec    1.00     83.8±0.33µs        ? ?/sec
concat utf8_view  max_str_len=20 null_density=0                1.18     90.6±0.28µs        ? ?/sec    1.00     76.8±0.40µs        ? ?/sec
concat utf8_view  max_str_len=20 null_density=0.2              1.17     97.2±0.34µs        ? ?/sec    1.00     82.9±0.16µs        ? ?/sec
concat utf8_view all_inline max_str_len=12 null_density=0      1.15     48.3±3.20µs        ? ?/sec    1.00     41.9±4.17µs        ? ?/sec
concat utf8_view all_inline max_str_len=12 null_density=0.2    1.20     54.0±2.85µs        ? ?/sec    1.00     45.1±2.52µs        ? ?/sec

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖 ./gh_compare_arrow.sh Benchmark Script Running
Linux aal-dev 6.14.0-1017-gcp #18~24.04.1-Ubuntu SMP Tue Sep 23 17:51:44 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Comparing safer-appendvalue-bytes-view (df730fd) to d49f017 diff
BENCH_NAME=filter_kernels
BENCH_COMMAND=cargo bench --features=arrow,async,test_common,experimental --bench filter_kernels
BENCH_FILTER=
BENCH_BRANCH_NAME=safer-appendvalue-bytes-view
Results will be posted here when complete

@alamb
Copy link
Contributor

alamb commented Oct 18, 2025

🤖: Benchmark completed

Details

group                                                                         main                                   safer-appendvalue-bytes-view
-----                                                                         ----                                   ----------------------------
filter context decimal128 (kept 1/2)                                          1.00     40.1±2.33µs        ? ?/sec    1.33     53.2±7.32µs        ? ?/sec
filter context decimal128 high selectivity (kept 1023/1024)                   1.00     48.9±0.70µs        ? ?/sec    1.07     52.5±0.67µs        ? ?/sec
filter context decimal128 low selectivity (kept 1/1024)                       1.00    231.2±0.36ns        ? ?/sec    1.03    237.2±0.60ns        ? ?/sec
filter context f32 (kept 1/2)                                                 1.00     97.9±0.21µs        ? ?/sec    1.00     97.7±0.17µs        ? ?/sec
filter context f32 high selectivity (kept 1023/1024)                          1.00     13.3±0.34µs        ? ?/sec    1.01     13.5±0.40µs        ? ?/sec
filter context f32 low selectivity (kept 1/1024)                              1.01    429.2±0.52ns        ? ?/sec    1.00    424.4±0.47ns        ? ?/sec
filter context fsb with value length 20 (kept 1/2)                            1.00     79.4±0.09µs        ? ?/sec    1.00     79.3±0.11µs        ? ?/sec
filter context fsb with value length 20 high selectivity (kept 1023/1024)     1.00     79.3±0.10µs        ? ?/sec    1.00     79.3±0.10µs        ? ?/sec
filter context fsb with value length 20 low selectivity (kept 1/1024)         1.00     79.3±0.09µs        ? ?/sec    1.00     79.4±0.16µs        ? ?/sec
filter context fsb with value length 5 (kept 1/2)                             1.00     79.3±0.09µs        ? ?/sec    1.00     79.5±0.09µs        ? ?/sec
filter context fsb with value length 5 high selectivity (kept 1023/1024)      1.00     79.3±0.16µs        ? ?/sec    1.00     79.4±0.09µs        ? ?/sec
filter context fsb with value length 5 low selectivity (kept 1/1024)          1.00     79.3±0.08µs        ? ?/sec    1.00     79.4±0.10µs        ? ?/sec
filter context fsb with value length 50 (kept 1/2)                            1.00     79.3±0.06µs        ? ?/sec    1.00     79.6±1.30µs        ? ?/sec
filter context fsb with value length 50 high selectivity (kept 1023/1024)     1.00     79.3±0.10µs        ? ?/sec    1.00     79.5±0.30µs        ? ?/sec
filter context fsb with value length 50 low selectivity (kept 1/1024)         1.00     79.3±0.09µs        ? ?/sec    1.00     79.3±0.09µs        ? ?/sec
filter context i32 (kept 1/2)                                                 1.00     16.8±0.04µs        ? ?/sec    1.00     16.8±0.05µs        ? ?/sec
filter context i32 high selectivity (kept 1023/1024)                          1.02      6.6±0.53µs        ? ?/sec    1.00      6.4±0.40µs        ? ?/sec
filter context i32 low selectivity (kept 1/1024)                              1.00    233.4±0.53ns        ? ?/sec    1.01    236.5±0.31ns        ? ?/sec
filter context i32 w NULLs (kept 1/2)                                         1.00     97.0±0.18µs        ? ?/sec    1.00     96.9±0.28µs        ? ?/sec
filter context i32 w NULLs high selectivity (kept 1023/1024)                  1.00     13.5±0.54µs        ? ?/sec    1.03     14.0±0.60µs        ? ?/sec
filter context i32 w NULLs low selectivity (kept 1/1024)                      1.01    427.6±3.48ns        ? ?/sec    1.00    422.0±0.90ns        ? ?/sec
filter context mixed string view (kept 1/2)                                   1.00    122.9±5.94µs        ? ?/sec    1.00    123.5±0.60µs        ? ?/sec
filter context mixed string view high selectivity (kept 1023/1024)            1.00     55.9±0.32µs        ? ?/sec    1.04     58.0±1.09µs        ? ?/sec
filter context mixed string view low selectivity (kept 1/1024)                1.00    622.5±0.86ns        ? ?/sec    1.03    641.7±0.76ns        ? ?/sec
filter context short string view (kept 1/2)                                   1.00    122.3±5.87µs        ? ?/sec    1.00    121.7±0.55µs        ? ?/sec
filter context short string view high selectivity (kept 1023/1024)            1.00     57.7±0.97µs        ? ?/sec    1.01     58.1±2.52µs        ? ?/sec
filter context short string view low selectivity (kept 1/1024)                1.00    452.7±0.98ns        ? ?/sec    1.03    464.1±1.66ns        ? ?/sec
filter context string (kept 1/2)                                              1.00   599.6±16.83µs        ? ?/sec    1.04   621.0±16.01µs        ? ?/sec
filter context string dictionary (kept 1/2)                                   1.00     17.2±0.04µs        ? ?/sec    1.01     17.3±0.04µs        ? ?/sec
filter context string dictionary high selectivity (kept 1023/1024)            1.01      7.1±0.50µs        ? ?/sec    1.00      7.1±0.39µs        ? ?/sec
filter context string dictionary low selectivity (kept 1/1024)                1.00    812.3±2.14ns        ? ?/sec    1.02    832.1±7.51ns        ? ?/sec
filter context string dictionary w NULLs (kept 1/2)                           1.00     97.6±0.26µs        ? ?/sec    1.00     97.5±0.15µs        ? ?/sec
filter context string dictionary w NULLs high selectivity (kept 1023/1024)    1.00     14.2±0.48µs        ? ?/sec    1.06     15.1±0.61µs        ? ?/sec
filter context string dictionary w NULLs low selectivity (kept 1/1024)        1.00   1034.6±2.27ns        ? ?/sec    1.02   1050.2±2.47ns        ? ?/sec
filter context string high selectivity (kept 1023/1024)                       1.00   629.4±13.27µs        ? ?/sec    1.06   665.5±12.51µs        ? ?/sec
filter context string low selectivity (kept 1/1024)                           1.06   1095.0±1.28ns        ? ?/sec    1.00   1036.3±1.18ns        ? ?/sec
filter context u8 (kept 1/2)                                                  1.00     15.2±0.11µs        ? ?/sec    1.03     15.6±0.05µs        ? ?/sec
filter context u8 high selectivity (kept 1023/1024)                           1.02   1912.5±6.22ns        ? ?/sec    1.00   1873.7±9.52ns        ? ?/sec
filter context u8 low selectivity (kept 1/1024)                               1.00    226.5±0.29ns        ? ?/sec    1.04    235.2±0.49ns        ? ?/sec
filter context u8 w NULLs (kept 1/2)                                          1.00     95.7±0.87µs        ? ?/sec    1.00     95.6±0.17µs        ? ?/sec
filter context u8 w NULLs high selectivity (kept 1023/1024)                   1.00      8.7±0.03µs        ? ?/sec    1.00      8.7±0.02µs        ? ?/sec
filter context u8 w NULLs low selectivity (kept 1/1024)                       1.00    424.3±0.74ns        ? ?/sec    1.25    529.2±0.70ns        ? ?/sec
filter decimal128 (kept 1/2)                                                  1.00     50.8±2.85µs        ? ?/sec    1.08     54.7±4.70µs        ? ?/sec
filter decimal128 high selectivity (kept 1023/1024)                           1.00     52.0±1.02µs        ? ?/sec    1.05     54.7±1.92µs        ? ?/sec
filter decimal128 low selectivity (kept 1/1024)                               1.00      2.9±0.01µs        ? ?/sec    1.00      2.9±0.01µs        ? ?/sec
filter f32 (kept 1/2)                                                         1.00    163.1±0.23µs        ? ?/sec    1.00    163.1±0.72µs        ? ?/sec
filter fsb with value length 20 (kept 1/2)                                    1.01    145.9±0.48µs        ? ?/sec    1.00    144.6±0.32µs        ? ?/sec
filter fsb with value length 20 high selectivity (kept 1023/1024)             1.00     69.1±0.30µs        ? ?/sec    1.00     69.2±1.01µs        ? ?/sec
filter fsb with value length 20 low selectivity (kept 1/1024)                 1.00      3.4±0.01µs        ? ?/sec    1.00      3.4±0.02µs        ? ?/sec
filter fsb with value length 5 (kept 1/2)                                     1.00    150.4±0.21µs        ? ?/sec    1.00    150.3±0.14µs        ? ?/sec
filter fsb with value length 5 high selectivity (kept 1023/1024)              1.06     11.5±0.73µs        ? ?/sec    1.00     10.9±0.47µs        ? ?/sec
filter fsb with value length 5 low selectivity (kept 1/1024)                  1.00      3.3±0.01µs        ? ?/sec    1.02      3.4±0.06µs        ? ?/sec
filter fsb with value length 50 (kept 1/2)                                    1.02    165.9±1.11µs        ? ?/sec    1.00    162.2±3.98µs        ? ?/sec
filter fsb with value length 50 high selectivity (kept 1023/1024)             1.01    223.5±4.31µs        ? ?/sec    1.00   221.8±20.06µs        ? ?/sec
filter fsb with value length 50 low selectivity (kept 1/1024)                 1.01      3.4±0.01µs        ? ?/sec    1.00      3.4±0.04µs        ? ?/sec
filter i32 (kept 1/2)                                                         1.00     46.1±0.06µs        ? ?/sec    1.00     46.2±0.10µs        ? ?/sec
filter i32 high selectivity (kept 1023/1024)                                  1.00      8.6±0.36µs        ? ?/sec    1.00      8.6±0.33µs        ? ?/sec
filter i32 low selectivity (kept 1/1024)                                      1.02      3.0±0.01µs        ? ?/sec    1.00      3.0±0.01µs        ? ?/sec
filter optimize (kept 1/2)                                                    1.00     53.7±0.07µs        ? ?/sec    1.00     53.9±0.14µs        ? ?/sec
filter optimize high selectivity (kept 1023/1024)                             1.06      2.7±0.01µs        ? ?/sec    1.00      2.6±0.00µs        ? ?/sec
filter optimize low selectivity (kept 1/1024)                                 1.00      3.1±0.01µs        ? ?/sec    1.00      3.1±0.01µs        ? ?/sec
filter run array (kept 1/2)                                                   1.00    380.9±0.75µs        ? ?/sec    1.02    389.5±0.63µs        ? ?/sec
filter run array high selectivity (kept 1023/1024)                            1.00    396.2±1.20µs        ? ?/sec    1.05    415.0±5.00µs        ? ?/sec
filter run array low selectivity (kept 1/1024)                                1.00    301.0±0.66µs        ? ?/sec    1.00    300.5±0.91µs        ? ?/sec
filter single record batch                                                    1.00     45.7±0.07µs        ? ?/sec    1.00     45.8±0.24µs        ? ?/sec
filter u8 (kept 1/2)                                                          1.00     45.8±0.07µs        ? ?/sec    1.00     45.8±0.05µs        ? ?/sec
filter u8 high selectivity (kept 1023/1024)                                   1.00      3.8±0.04µs        ? ?/sec    1.00      3.8±0.01µs        ? ?/sec
filter u8 low selectivity (kept 1/1024)                                       1.03      3.1±0.01µs        ? ?/sec    1.00      3.0±0.01µs        ? ?/sec

rluvaton and others added 4 commits October 18, 2025 18:24
# Which issue does this PR close?

N/A

# Rationale for this change

not testing the correct length

# What changes are included in this PR?

remove * 8 as the length of the buffer is in bytes already

# Are these changes tested?
created tests to make sure they are failing before AND created tests
that make sure that ceil is used for future changes

# Are there any user-facing changes?

Nope
…tArray` (apache#8627)

# Which issue does this PR close?

- Closes apache#8610

# Rationale for this change

Since the fields of `VariantArray` impl `PartialEq`, this PR simply
derives `PartialEq` for `VariantArray`
out.

Based off of apache#8625
…trings for error messages (apache#8636)

# Which issue does this PR close?

This is a small performance improvement for the thrift remodeling

- Part of apache#5853.

# Rationale for this change

Some of the often-called methods in the thrift protocol implementation
created `ParquetError` instances with a string message that had to be
allocated and formatted. This formatting code and probably also some
drop glue bloats these otherwise small methods and prevented inlining.

# What changes are included in this PR?

Introduce a separate error type `ThriftProtocolError` that is smaller
than `ParquetError` and does not contain any allocated data. The
`ReadThrift` trait is not changed, since its custom implementations
actually require the more expressive `ParquetError`.

# Are these changes tested?

The success path is covered by existing tests. Testing the error paths
would require crafting some actually malformed files, or using a fuzzer.

# Are there any user-facing changes?

The `ThriftProtocolError` is crate-internal so there should be no api
changes. Some error messages might differ slightly.
@samueleresca samueleresca force-pushed the safer-appendvalue-bytes-view branch from df730fd to a0e79a4 Compare October 18, 2025 17:25
@github-actions github-actions bot added parquet Changes to the parquet crate parquet-variant parquet-variant* crates labels Oct 18, 2025
@github-actions github-actions bot removed parquet Changes to the parquet crate parquet-variant parquet-variant* crates labels Oct 18, 2025
@alamb
Copy link
Contributor

alamb commented Oct 19, 2025

I reviewed the benchmarks and I conclude they don't show any meaningful performance change, as expected.

Thanks again @samueleresca

@alamb alamb merged commit 2f96204 into apache:main Oct 19, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

arrow Changes to the arrow crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants